#define _CRT_SECURE_NO_WARNINGS 1
#include "BTree.h";

BTNode* BinaryTreeCreate(BTDataType* a, int* pi) 
{
    if (a[(*pi)] == '#') 
    {
        (*pi)++;
        return NULL;
    }

    struct BinaryTreeNode* root = (struct BinaryTreeNode*)malloc(sizeof(struct BinaryTreeNode));
    if (root == NULL) 
    {
        printf("malloc fail");
        return 0;
    }
    root->_data = a[(*pi)++];
    root->_left = BinaryTreeCreate(a, pi);
    root->_right = BinaryTreeCreate(a, pi);
    return root;

}

void BinaryTreeInOrder(BTNode* root) 
{
    if (root == NULL) 
    {
        return;
    }

    BinaryTreeInOrder(root->_left);
    printf("%c ", root->_data);
    BinaryTreeInOrder(root->_right);
}